package bank;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import beans.OverzTransactiesBean;

public class OverzTransacties extends HttpServlet {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public void init() {
		System.out.println("OverzTransacties.init()");
	}
	
	public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		System.out.println("OverzTransacties.doGet()");
		try {
			UberClass u = new UberClass(request, response);
			OverzTransactiesBean transacties = new OverzTransactiesBean(u.getOffice().getPendingTransactions());
			request.setAttribute("transactie", transacties);
			u.vars.put( "inoverzicht", "true" );
			u.startOutput();
		} catch(Exception e) {
			e.printStackTrace();
		}
	}
	
	public void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException	{
		try {
			UberClass u = new UberClass(request, response);
			u.getOffice().sync();
			OverzTransactiesBean transacties = new OverzTransactiesBean(u.getOffice().getPendingTransactions());
			request.setAttribute("transactie", transacties);
			u.vars.put( "inoverzicht", "true" );
			u.startOutput();
		} catch(Exception e) {
			e.printStackTrace();
		}		
	}
}